home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / MBLIB10.ZIP;1 / CPPEXAMP.ZIP / WRTMSG.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  1.4 KB  |  54 lines

  1. /* Write a demo message to All in board 1. */
  2.  
  3. #include    <iostream.h>
  4. #include    <process.h>
  5.  
  6. #include    "msgbase.hpp"
  7.  
  8. void main (void)
  9.  
  10. {
  11.     MsgBase    Message ("D:\\TMP\\TMP");
  12.  
  13.     if (!Message.ErrorType)
  14.     {
  15.         //    make a text body
  16.  
  17.         Message << "\001PID: WRTMSG 1.0\r";
  18.         Message << "This is the first paragraph of this message.\n";
  19.         Message << "Text will be added until a Hard Carriage Return";
  20.         Message << "is encountered. I've added one to this line.\r";
  21.         Message << "This is the second paragraph. As you can see the \\n, ";
  22.         Message << "which was added above, has been ignored according ";
  23.         Message << "to FSC-0001.\r";
  24.  
  25.         //    initialize header
  26.  
  27.         Message.To ("All");
  28.         Message.From ("Feico de Boer");
  29.         Message.Subject ("Just a test");
  30. //        Message.SetAttribute (0, MA_UNSENT | MA_PRIVATE | MA_LOCAL);
  31.         Message.SetAttribute (MsgHdr::Unsent | MsgHdr::Private |
  32.                                                             MsgHdr::Local);
  33.  
  34.         //    write message
  35.  
  36.         Message.Board (1);
  37.         if (Message.Lock ("D:\\TMP\\TMP"))
  38.         {
  39.             cerr << "Error locking message base";
  40.             exit (1);
  41.         }
  42.         if (Message.WriteNew ())    /* See how easy it is? */
  43.             cerr << "Error writing message base: " << Message.ErrorType
  44.                  << ", " << Message.ErrorString << ".\n";
  45.         Message.Unlock ();
  46.     }
  47.     else
  48.     {
  49.         cerr << "Error opening message base: " << Message.ErrorType << ", "
  50.              << Message.ErrorString << ".\n";
  51.         exit (1);
  52.     }
  53. }
  54.